package com.crm.jdy.service.usermanager;

import com.crm.jdy.common.dto.PermissionInfoDto;
import com.crm.jdy.common.pojo.PermissionInfo;
import com.crm.jdy.common.mapper.PermissionInfoMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**   
 * @Description:(权限管理服务实现)
 *
 * @version: V1.0
 * @author: kong
 * 
 */
@Service(version = "${service.version}")
@Component
public class PermissionInfoServiceImpl  extends ServiceImpl<PermissionInfoMapper,PermissionInfo> implements PermissionInfoService  {

    @Autowired
    PermissionInfoMapper permissionInfoDao;


    @Override
    public PageInfo<PermissionInfo> seletePermissionInfo(PermissionInfoDto callAplanInfoDto) {
      PageHelper.startPage( callAplanInfoDto.getCurrentPage(),callAplanInfoDto.getPageSize());
        List<PermissionInfo> bookList = permissionInfoDao.seletePermissionInfo(callAplanInfoDto);
        PageInfo<PermissionInfo> pageInfo = new PageInfo<PermissionInfo>(bookList);
        return pageInfo;
    }

    @Override
    public boolean updatePermissionInfo(PermissionInfo callAplanInfoDto) {
        return  permissionInfoDao.updateById(callAplanInfoDto) > 0;
    }

    @Override
    public boolean addPermissionInfo(PermissionInfo callAplanInfo) {
        return permissionInfoDao.insert(callAplanInfo) > 0;
    }

    @Override
    public boolean removePermissionInfo(String aplanId) {
        return permissionInfoDao.deleteById(aplanId) > 0;
    }

}